package top.fengleifeng.question;

/**
 * @author : fengelfeing
 * @version V1.0
 * @Project: leetcode-test
 * @Package : top.fengleifeng.question
 * @Description:
 * @Date: 2020年11月16日5:49 下午
 */
public class Num392判断子序列 {

    class Solution {
        public boolean isSubsequence(String s, String t) {
            if(s.length()==0){
                return true;
            }
            int sLength = s.length();
            int tLength = t.length();
            int sIndex = 0;
            for (int i = 0; i < tLength; i++) {
                if(t.charAt(i) == s.charAt(sIndex)){
                    sIndex++;
                }
                if(sIndex==sLength){
                    return true;
                }
            }
            return false;
        }
    }
}
